package de.gameduell.framework.error {
	
	import de.gameduell.framework.error.GDError;
	import de.gameduell.framework.error.GDErrorEvent;
	
	import flash.events.EventDispatcher;	

	/**
	 * @author cbra
	 */
	public class ErrorManager extends EventDispatcher {
		private static var INSTANCE:ErrorManager = null;
		
		private var errors:Array;

		public static function getInstance():ErrorManager{
			if(INSTANCE == null){
				INSTANCE = new ErrorManager();		
			}
			return INSTANCE;
		}
			
		public function ErrorManager() {
			errors = new Array();
		}
		
		public function register(error:GDError):void {
			errors.push(error);
			var event:GDErrorEvent = new GDErrorEvent(error);
			dispatchEvent(event);
		}
		
	}
}
